package  
{
	import flash.display.*;
	import flash.events.*;
	import iks.utils.geom.*;
	import vehicle.*;
	
	public final class PathTest extends Sprite 
	{
		
		public function PathTest() 
		{
			m_vehicle = new SteeredVehicle();
			m_vehicle.edgeBehavior = Vehicle.BOUNCE;
			this.addChild(m_vehicle);
			
			m_path = new Vector.<Vector2D>();
			
			this.stage.addEventListener(MouseEvent.CLICK, onClickHandler);
			this.stage.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
		}
		
		private function onClickHandler(evt : MouseEvent) : void
		{
			this.graphics.lineStyle(0, 0, 0.25);
			if (m_path.length == 0)
				this.graphics.moveTo(this.mouseX, this.mouseY);
				
			this.graphics.lineTo(this.mouseX, this.mouseY);
			this.graphics.drawCircle(this.mouseX, this.mouseY, 10);
			this.graphics.moveTo(this.mouseX, this.mouseY);
			m_path.push(new Vector2D(this.mouseX, this.mouseY));
		}
		
		private function onEnterFrameHandler(evt : Event) : void
		{
			m_vehicle.followPath(m_path, false);
			m_vehicle.update();
		}
	
		private var m_vehicle : SteeredVehicle = null;
		private var m_path : Vector.<Vector2D> = null;
	}

}

































///////////////////////////////////////////////////////////////////////////////////////////////////
// end file